/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.agi.devsol.webutil;

import java.util.HashMap;
import javax.enterprise.context.RequestScoped;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.inject.Named;
import javax.servlet.http.HttpSession;

/**
 *
 * @author rgrosz
 */
@RequestScoped
@Named
public class SessionData {
    
    private HttpSession session;
    public SessionData(){
        ExternalContext ec = FacesContext.getCurrentInstance().getExternalContext();
        this.session = (HttpSession) ec.getSession(false);
    }
    
    public Object getData(String key){
        return this.session.getAttribute(key);
    }
    
    public void setData(String key, Object o){
        this.session.setAttribute(key, o);        
    }
    
    public void removeData(String key){
        this.session.removeAttribute(key);
    }
    
    public void setHttpSession(HttpSession httpSession){
        this.session = httpSession;                
    }
}
